home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Interface.as < prev    next >
Text File  |  2013-04-24  |  2KB  |  87 lines

  1. class Interface extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var sSTATE_SHOW = "ShowScreen";
  5.    function Interface(_mcRef)
  6.    {
  7.       super(_mcRef);
  8.       CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  9.       this.bTimePaused = false;
  10.       this.setState(Interface.sSTATE_IDLE);
  11.    }
  12.    function doShow()
  13.    {
  14.       if(this.sState == Interface.sSTATE_IDLE)
  15.       {
  16.          this.setState(Interface.sSTATE_SHOW);
  17.          CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  18.          this.mcRef.btnMenu.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  19.          this.mcRef.btnMenu.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickMenuButton);
  20.          this.setScoreValue(CTRLGame.getRef().Score);
  21.       }
  22.    }
  23.    function doHide()
  24.    {
  25.       if(this.sState != Interface.sSTATE_IDLE)
  26.       {
  27.          this.setState(Interface.sSTATE_IDLE);
  28.       }
  29.    }
  30.    function setScoreValue(_nScore)
  31.    {
  32.       if(this.sState == Interface.sSTATE_SHOW)
  33.       {
  34.          this.mcRef.txtScore.text = Utils.styleNumber(_nScore);
  35.       }
  36.    }
  37.    function doPause()
  38.    {
  39.    }
  40.    function doUnPause()
  41.    {
  42.    }
  43.    function pauseTime()
  44.    {
  45.       this.bTimePaused = true;
  46.    }
  47.    function unPauseTime()
  48.    {
  49.       this.bTimePaused = false;
  50.    }
  51.    function setToLife(_nValue)
  52.    {
  53.       CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs + _nValue);
  54.       if(CTRLGame.getRef().Songs < 0)
  55.       {
  56.          CTRLGame.getRef().modifyTime(0);
  57.       }
  58.       else if(CTRLGame.getRef().Songs > LD.getSongsMax(CTRLGame.getRef().Level))
  59.       {
  60.          CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  61.       }
  62.    }
  63.    function Idle()
  64.    {
  65.    }
  66.    function ShowScreen()
  67.    {
  68.       if(!Controller.getRef().isPaused() && !this.bTimePaused)
  69.       {
  70.          if(CTRLGame.getRef().Songs > 0)
  71.          {
  72.             CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs - 1);
  73.          }
  74.          else
  75.          {
  76.             Main.getRef().loseGame();
  77.          }
  78.       }
  79.       var _loc2_ = this.mcRef.mcSongs._totalframes - Math.round(CTRLGame.getRef().Songs / LD.getSongsMax(CTRLGame.getRef().Level) * 100);
  80.       if(_loc2_ <= 0)
  81.       {
  82.          _loc2_ = 1;
  83.       }
  84.       this.mcRef.mcSongs.gotoAndStop(_loc2_);
  85.    }
  86. }
  87.